/**
 * 
 */
package com.dream.house.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;

import cn.com.servyou.base.exception.ServiceException;
import cn.com.servyou.utils.CoreUtils;

import com.dream.house.dao.GroupDAO;
import com.dream.house.dao.UserDAO;
import com.dream.house.entity.GroupDTO;
import com.dream.house.entity.UserDTO;

/**
 * @author ahk
 * @since 1.0
 */
public class UserService {
	@Autowired
	private UserDAO userDAO;
	@Autowired
	private GroupDAO groupDAO;
	
	public UserDTO getUser(String userId ,String groupId) throws ServiceException {
		if(!CoreUtils.strIsNull(userId) && !CoreUtils.strIsNull(groupId))
			return userDAO.getUser(userId,groupId);
		
		return null;
	}

	public GroupDTO getGroup(String id) throws ServiceException {
		if(!CoreUtils.strIsNull(id))
			return groupDAO.getGroup(id);
		
		return null;
	}

	public List<GroupDTO> getGroups(String userId) throws ServiceException {
		
		return groupDAO.getGroups(userId);
	}
	
	public String getGroupName(String id) throws ServiceException {
		
		return groupDAO.getGroupName(id);
	}

}
